﻿using System;
using MessagePack.Internal;

namespace MessagePack.Decoders
{
	// Token: 0x020000E1 RID: 225
	internal class Ext8DateTime : IDateTimeDecoder
	{
		// Token: 0x06000344 RID: 836 RVA: 0x0000C507 File Offset: 0x0000A907
		private Ext8DateTime()
		{
		}

		// Token: 0x06000345 RID: 837 RVA: 0x0000C510 File Offset: 0x0000A910
		public DateTime Read(byte[] bytes, int offset, out int readSize)
		{
			byte b = bytes[checked(offset + 1)];
			sbyte b2 = (sbyte)bytes[offset + 2];
			if (b != 12 || (int)b2 != -1)
			{
				throw new InvalidOperationException(string.Format("typeCode is invalid. typeCode:{0}", b2));
			}
			uint num = (uint)((int)bytes[offset + 3] << 24 | (int)bytes[offset + 4] << 16 | (int)bytes[offset + 5] << 8 | (int)bytes[offset + 6]);
			long num2 = (long)bytes[offset + 7] << 56 | (long)bytes[offset + 8] << 48 | (long)bytes[offset + 9] << 40 | (long)bytes[offset + 10] << 32 | (long)bytes[offset + 11] << 24 | (long)bytes[offset + 12] << 16 | (long)bytes[offset + 13] << 8 | (long)bytes[offset + 14];
			readSize = 15;
			return DateTimeConstants.UnixEpoch.AddSeconds((double)num2).AddTicks((long)((ulong)(num / 100U)));
		}

		// Token: 0x040000FB RID: 251
		internal static readonly IDateTimeDecoder Instance = new Ext8DateTime();
	}
}
